/**
 *******************************************************************************
 * @FileName  : tlsr825x_pwr.h
 * @Author    : GaoQiu
 * @CreateDate: 2020-09-10
 * @Copyright : Copyright(C) GaoQiu
 *              All Rights Reserved.
 *
 *******************************************************************************
 *
 * The information contained herein is confidential and proprietary property of
 * GaoQiu and is available under the terms of Commercial License Agreement
 * between GaoQiu and the licensee in separate contract or the terms described
 * here-in.
 *
 * This heading MUST NOT be removed from this file.
 *
 * Licensees are granted free, non-transferable use of the information in this
 * file under Mutual Non-Disclosure Agreement. NO WARRENTY of ANY KIND is provided.
 *
 *******************************************************************************
 */
#ifndef _TLSR825X_PWR_H
#define _TLSR825X_PWR_H

/*!  Sleep mode define. */
typedef enum{
	SLEEP_Mode_Suspend  = 0x00, /*!< suspend */
	SLEEP_Mode_Deep     = 0x01, /*!< deep    */
}SleepMode_Type_t;

/*!  Wake-up source define. */
typedef enum{
	WAKE_Src_Pad        = 0x10,
	WAKE_Src            = 0x20,
	WAKE_Src_Timer      = 0x40,
	WAKE_Src_Comparator = 0x80,
}WakeSrc_Type_t;

/*!  Wake-up state source define. */
typedef enum{
	WAKE_State_comparator = 0x01,
	WAKE_State_Timer      = 0x02,
	WAKE_State_Core       = 0x04,
	WAKE_State_Pad        = 0x08,

	WAKE_State_Err        = 0x80, /*!< GPIO error wake-up. */
}WakeState_Type_t;

/**
 * @brief : reboot MCU.
 * @param : none.
 * @return: none.
 */
void PWR_Reboot(void);

/**
 * @brief : 32k RC calibration.
 * @param : none.
 * @return: none.
 */
void PWR_32kRcCali(void);

/**
 * @brief : doubler calibration.
 * @param : none.
 * @return: none.
 */
void PWR_DoublerCali(void);

/**
 * @brief : MCU sleep.
 * @param : Sleep_Mode    can be SLEEP_Mode_Suspend / SLEEP_Mode_Deep
 * @param : wakeSrc       can be WAKE_Src_Pad ...
 * @param : wakeTick      wake up point. abstraction tick value.
 * @return: return wake state. can be WAKE_State_Pad...
 */
uint8_t PWR_Sleep(uint8_t sleepMode, uint8_t wakeSrc, uint32_t wakeTick);

#endif
